#!/usr/local/env python3
#-*- coding:utf-8 -*-
'''
Author:@南非波波
Blog:http://www.cnblogs.com/songqingbo/
E-mail:qingbo.song@gmail.com
'''

# UsersListFile = "./UsersListFile.txt"
# db = {"user":"swht","passwd":"shen1234"}
# db = str(db)
# UsersListAdd = open(UsersListFile,'a')
# UsersListAdd.write(db + '\n')
# UsersListAdd.close()


# UsersList = open(UsersListFile,'r')
# # print(UsersList.readlines())
# for lines in UsersList.readlines():
# 	print(lines.strip("\n").strip())
# 	# print(type(lines))
# 	lines = eval(lines)
# 	# print(type(lines))
# UsersList.close()
import os
UserBlackPath = "./UserBlack.txt"
if os.path.exists(UserBlackPath):	#判断黑名单文件是否存在
		FileUsers = open(UserBlackPath)	#打开黑名单文件
		for UserBlack in FileUsers.readlines():	#读取黑名单文件内容
			if UserName == UserBlack:  #判断黑名单列表中用户名称是否与指定userName相同
				print("对不起,该用户已在系统黑名单列表中,请联系管理员!")
				time.sleep(1)
				sys.exit(1)  #若相同提醒用户‘该用户在黑名单列表中’并且退出程序
		FileUsers.close()	#关闭黑名单文件句柄
else:
	print("文件不存在!")